﻿<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>应用更新</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/plugins/layui/css/layui.css" media="all">
</head>
<body>
  <div class="layui-row" style="padding: 20px 30px 0 0;">
    <div class="layui-col-md12" id="uploadfile">
        <div class="layui-form-item" >
          <label class="layui-form-label" style="width:120px;">上传更新文件：</label>
          <div class="layui-input-inline">
           <div class="layui-upload">
              <button type="button" class="layui-btn" id="btn_upload_change"><i class="layui-icon"></i>选择更新文件</button>
            </div>
            <div class="layui-form-item layui-hide">
              <input type="button" id="btn_submit" value="确定">
            </div>
          </div>
        </div>
      </div>
  </div>
  <script src="/plugins/layui/layui.js"></script>
  <script>
  layui.config({
    base: '/plugins/layuiadmin/' 
  }).extend({
    index: 'lib/index'
  }).use(['index', 'form','upload'], function(){
    var $ = layui.$, form = layui.form, router = layui.router(), upload = layui.upload;
    var index = parent.layer.getFrameIndex(window.name); 

    upload.render({
      elem: '#btn_upload_change'
      ,url: 'app_upgrade?id='+router.search.id
      ,accept: 'file'
      ,exts: 'zip|fpk'
      ,auto: false
      ,bindAction: '#btn_submit'
      ,before: function(obj){
        layer.load();
      }
      ,done: function (res) {
          layer.closeAll('loading'); 
          if (res.code == 0) {
              layer.msg(res.msg,{time:1*1000},function(){
                  parent.layer.close(index);
                  parent.GetFirstList();
               });
          }
          else {
              layer.alert(res.msg);
          }
      }
    });
  })
  </script>
</body>
</html>